<template>
  <div v-if="visible" class="modal-overlay">
    <div class="modal-content">
      <h3>Calculation History</h3>
      <ul>
        <li v-for="(entry, index) in history" :key="index">{{ entry }}</li>
      </ul>
      <button @click="closeModal">Close</button>
    </div>
  </div>
</template>
 
<script lang="ts">
import { defineComponent, PropType } from 'vue';
 
export default defineComponent({
  name: 'HistoryModal',
  props: {
    history: {
      type: Array as PropType<string[]>,
      required: true,
    },
    visible: {
      type: Boolean,
      required: true,
    },
  },
  setup(_props, { emit }) {
    const closeModal = () => {
      emit('closeModal', false);
    };
 
    return {
      closeModal,
    };
  },
});
</script>
 
<style scoped>
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
 
.modal-content {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 500px;
  text-align: left;
}
 
.modal-content h3 {
  margin-top: 0;
}
 
.modal-content button {
  margin-top: 10px;
  padding: 10px 15px;
  border: none;
  border-radius: var(--modal-content-border-radius);
  background-color: #007bff; /* Example color */
  color: white;
  cursor: pointer;
  transition: background-color var(--modal-transition-duration) ease-in-out;
  float: right;
  border-radius: 4px;
}

</style>